package studio.banner.reference.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import studio.banner.reference.util.CheckUtil;
import studio.banner.reference.util.ResultBean;

import java.io.IOException;
import java.util.List;

/**
 * @ClassName VisitorController
 * @Deacription TODO
 * @Author Baofeng.Wu
 * @Date 2019/10/31 14:47
 **/
@Controller
public class VisitorController extends BaseController {

    /**
     * 文献格式校对
     *
     * @param docContent
     * @return
     */
    @PostMapping("/check")
    @ResponseBody
    public ResultBean formatCheck(String docContent) {
        return new ResultBean(new CheckUtil().formatCheck(docContent));
    }

    /**
     * 文献文档导入
     *
     * @param file
     * @return
     * @throws IOException
     */
    @PostMapping("/upload")
    @ResponseBody
    public ResultBean wordImport(MultipartFile file) throws IOException {
        List list = documentService.wordImport(file);
        return new ResultBean(list);
    }
}
